/*-------------------------------------------------------------------------------------------*/
/*------------------------------Special feature Of LPC1768-----------------------------------*/
/*-------------------------------------------------------------------------------------------*/

#ifndef __BITBAND_H__
#define __BITBAND_H__
/*--------------------------------------bit-band map-----------------------------------------*/
/* The memory map has two 32MB alias regions that map to two 1MB bit-band regions
 *
 * 32MB SRAM alias region map to the 1MB SRAM bit-band region: 
 * ALL SECTION : 0x22000000 - 0x23FFFFFF map to 0x20000000 - 0x200FFFFF
 * REAL SECTION: 0x22F80000 - 0x23080000 map to 0x2007C000 - 0x20084000
 *
 * 32MB peripheral alias region map to the 1MB peripheral bit-band region:
 * 0x42000000 - 0x44FFFFFF map to 0x40000000 - 0x400FFFFF
 *
 *-------------------------------------------------------------------------------------------*/

#define SRAM_BIT_BAND_BASE 0x2007C000
#define SRAM_BIT_BAND_END  0x20084000
#define SRAM_ALIAS_BASE    0x22F80000
#define SRAM_ALIAS_END     0x23080000

/*------------------------------------------------------------------------------------------*
 #define DEVICE_REG0 ((volatile unsigned long *) (0x20000000)) 
 #define DEVICE_REG0_BIT0 ((volatile unsigned long *) (0x22000000)) 
 #define DEVICE_REG0_BIT1 ((volatile unsigned long *) (0x22000004)) 
 
 volatile unsigned long bbVarAry[7] __attribute__(( at(0x20003014) )); 
 volatile unsigned long* const pbbaVar= (void*)(0x22000000+0x3014*8*4); 
 */
 
 /*-------------------------------bit-band map to alias U32---------------------------------*/
 typedef struct
 {
	 unsigned long bit0;
	 unsigned long bit1;
	 unsigned long bit2;
	 unsigned long bit3;
	 unsigned long bit4;
	 unsigned long bit5;
	 unsigned long bit6;
	 unsigned long bit7;
	 unsigned long bit8;
	 unsigned long bit9;
	 unsigned long bit10;
	 unsigned long bit11;
	 unsigned long bit12;
	 unsigned long bit13;
	 unsigned long bit14;
	 unsigned long bit15;
	 unsigned long bit16;
	 unsigned long bit17;
	 unsigned long bit18;
	 unsigned long bit19;
	 unsigned long bit20;
	 unsigned long bit21;
	 unsigned long bit22;
	 unsigned long bit23;
	 unsigned long bit24;
	 unsigned long bit25;
	 unsigned long bit26;
	 unsigned long bit27;
	 unsigned long bit28;
	 unsigned long bit29;
	 unsigned long bit30;
	 unsigned long bit31;
 } ALIAS_U32_Type;
 /*----------------------------------------------------------------------------------------*/
 
 /*-------------------------------bit-band map to alias U16--------------------------------*/
 typedef struct
 {
	 unsigned long bit0;
	 unsigned long bit1;
	 unsigned long bit2;
	 unsigned long bit3;
	 unsigned long bit4;
	 unsigned long bit5;
	 unsigned long bit6;
	 unsigned long bit7;
	 unsigned long bit8;
	 unsigned long bit9;
	 unsigned long bit10;
	 unsigned long bit11;
	 unsigned long bit12;
	 unsigned long bit13;
	 unsigned long bit14;
	 unsigned long bit15;
 } ALIAS_U16_Type;
 /*----------------------------------------------------------------------------------------*/
 
 /*-------------------------------bit-band map to alias U8----------------------------------*/
 typedef struct
 {
	 unsigned long bit0;
	 unsigned long bit1;
	 unsigned long bit2;
	 unsigned long bit3;
	 unsigned long bit4;
	 unsigned long bit5;
	 unsigned long bit6;
	 unsigned long bit7;
 } ALIAS_U8_Type;
 /*----------------------------------------------------------------------------------------*/
 #endif
